/* The file is saved in UTF-8 codepage.
 * Check: «Stereotype», Section mark-§, Copyright-©, Alpha-α, Beta-β, Smile-☺
 */
package cz.pecinovsky.english.lootp._101_;

import cz.pecinovsky.english.lootp._000_.Run;

// %X+ <107
import cz.pecinovsky.english.lootp.utility.NamedColor;
import cz.pecinovsky.english.lootp.utility.IO;
// %X-

// %I1 <110a
//import cz.pecinovsky.english.lootp.shapes.Canvas;
//import cz.pecinovsky.english.lootp.shapes.Ellipse;
//import cz.pecinovsky.english.lootp.shapes.Rectangle;
//import cz.pecinovsky.english.lootp.shapes.Triangle;
// %I-

// %I1 =110a
//import cz.pecinovsky.english.lootp.shapes.Canvas;
//
//import cz.pecinovsky.english.lootp.shapes.Ellipse;
//import cz.pecinovsky.english.lootp.shapes.Rectangle;
//import cz.pecinovsky.english.lootp.shapes.Triangle;
//import cz.pecinovsky.english.lootp.shapes.Mover;
// %I-

// %I1 >110a <114 >115 <119
//import cz.pecinovsky.english.lootp.shapes.Canvas;
//
//import cz.pecinovsky.english.lootp.shapes.Mover;
//
//import cz.pecinovsky.english.lootp.shapes.Ellipse;
//import cz.pecinovsky.english.lootp.shapes.Rectangle;
//import cz.pecinovsky.english.lootp.shapes.Triangle;
// %I-

import cz.pecinovsky.english.lootp.manager.Ellipse;
import cz.pecinovsky.english.lootp.manager.Rectangle;
import cz.pecinovsky.english.lootp.manager.Triangle;

import cz.pecinovsky.english.lootp.manager.Mover;


import cz.pecinovsky.english.lootp.manager.CanvasManager_Envelope.               CanvasManager;



import cz.pecinovsky.english.lootp._101_.Test_104_125.Test;
////////////////////////////////////////////////////////////////////////////////
//%%+  +++++ End of ignored starting test - place for imports +++++

//%X+ xxxxx Start of the ovejumped text with declaration of the envelope xxxxx
/*******************************************************************************
 *<pre>
 * Předchozí: _109_Test v projektu 009z_01_Tvary
 *
 * Přidáno:
 *    - testSmoothMovements
 *
 * Upraveno:
 *      *
 *</pre>
 */
public class Test_104_125
{    private Test_104_125() {}   static
////////////////////////////////////////////////////////////////////////////////
//%X- ----- End of the ovejumped text with declaration of the envelope -----


/*******************************************************************************
 * The class {@code Test} defines a set of unit tests
 * created in the interractive mode.
 *
 * @author Rudolf PECINOVSKÝ
 * @version 6.03.2017 — 2010-11-08 triangle1
 */
public class Test extends junit.framework.TestCase
{
//%A+ >109
    private Rectangle rectangl0;
    private Ellipse   ellipse0;
    private Triangle  triangle0;
//%A-
    private Rectangle rectangl1;
    private Ellipse   ellipse1;
    private Triangle  triangle1;
//%A+ >114 -115 >119
    private CanvasManager CM;
//%A-



//== CONSTANT CLASS ATTRIBUTES =================================================
//== VARIABLE CLASS ATTRIBUTES =================================================
//== STATIC CONSTRUCTOR (CLASS INITIALIZER, STATIC INICITALIZING BLOCK) ========
//== CONSTANT INSTANCE ATTRIBUTES ==============================================
//== VARIABLE INSTANCE ATTRIBUTES ==============================================
//== CLASS GETTERS AND SETTERS =================================================
//== OTHER NON-PRIVATE CLASS METHODS ===========================================

//##############################################################################
//== CONSTUCTORS AND FACTORY METHODS ===========================================

    /***************************************************************************
     * Creates a test with a given name.
     *
     * @param testName  The name of the created test
     */
    public Test(String testName)
    {
        super(testName);
    }



//== PREPARATION AND CLEANING THE FIXTURE ======================================

    /***************************************************************************
     * Creates a test fixture, i.e. a set of objects that will be prepared
     * before each run test.
      */
    @Override
    protected void setUp()
    {
//%I+ <107
//        rectangl1 = new Rectangle();
//        ellipse1  = new Ellipse();
//        triangle1 = new Triangle();
//%I-
//%A+ >109
        rectangl0 = new Rectangle   ();
        ellipse0  = new Ellipse     ();
        triangle0 = new Triangle();
//%A-
//%A+ >107
        rectangl1 = new Rectangle   (50, 50, 200, 100);
        ellipse1  = new Ellipse     (50, 50, 200, 100);
        triangle1 = new Triangle(50, 50, 200, 100);
//%A-
//%A+ >114 -115 >119
        rectangl0.paint();
        ellipse0 .paint();
        triangle0.paint();
        rectangl1.paint();
        ellipse1 .paint();
        triangle1.paint();
//%A-
//%A+ >107
        IO.inform("Fixture prepared");
//%A-
    }


    /***************************************************************************
     * Clean up after each test.
     */
    @Override
    protected void tearDown()
    {
    }



//== ABSTRACT METHODS ==========================================================
//== INSTANCE GETTERS AND SETTERS ==============================================
//== OTHER NON-PRIVATE INSTANCE METHODS ========================================
//== PRIVATE AND AUXILIARY CLASS METHODS =======================================
//== PRIVATE AND AUXILIARY INSTANCE METHODS ====================================
//== EMBEDDED TYPES AND INNER CLASSES ==========================================
//== THE TESTS =================================================================
//
//     /***************************************************************************
//      *
//      */
//     public void testXXX()
//     {
//     }

    public void testMovements()
    {
        triangle1.moveDown();
        ellipse1 .moveRight();
        rectangl1.paint();
    }


    public void testMovements2()
    {
        ellipse1 .moveDown();
        triangle1.moveRight();
        rectangl1.paint();
    }

//%A+ >108

    public void testColor()
    {
        NamedColor BARVA_OBD = rectangl1.getColor();
        triangle1.setColor(BARVA_OBD);
        NamedColor.showDefinedNames();
        NamedColor GRAY = NamedColor.getNamedColor("gray");
        triangle1.setColor(GRAY);
        triangle1.setColor(BARVA_OBD);
        IO.inform("It is red, it will be gray");
        triangle1.setColor(GRAY);
        IO.inform("It is gray, it will have the ellipse's color");
        triangle1.setColor(ellipse1.getColor());
    }

//%A-
//%A+ >=110z

    public void testSmoothMovements()
    {
        Mover mover = new Mover(3);
        mover.moveBy( 0, 50, triangle1);
        mover.moveTo(50,  0, ellipse1);
        rectangl0.paint();
    }

//%A-
//%X+
     /** */
     public void testFixture() {}
//%X-
}

//%%- ---- Start of the ovejumped text with closing of the envelope ----
////////////////////////////////////////////////////////////////////////////////
//== TESTING CLASSES AND METHODS ===============================================
//If the class is not the testing one, the folowing two method can be removed
//%X+   Method prepared for inserting into tested classes
     /** */
     public void testFixture() {}

//%X-

    /***************************************************************************
     * Instances of the class {@code TearDown}
     * take care about cleaning up between particular tests
     * They executes the code, which is impossible to incorporate
     * into the method {@link #tearDown()},
     * until the students will not be able to program.
     */
    private static class TearDown implements Run.ITD
    {
        /** {@inheritDoc} */
        @Override
        public void cleanUp()
        {
//            Canvas.clearCanvas();
            CanvasManager.getInstance().removeAll();
        }
    }


    /***************************************************************************
     * Test method.
     */
    public static void test()
    {
        Run.tests(Test.class,
                new TearDown(),
//                "testFixture",
//                "testMovements",
//                "testMovements2",
//                "testSmoothMovements",
                ""
               );
        System.exit(0);
    }
    /** @param args Command line arguments - they are not used. */
    public static void main(String[] args)  {  test();  }
}
